package com.dandelion.common.utils;


import java.util.concurrent.atomic.AtomicInteger;

public abstract class OrderNoGenerator {
    private static AtomicInteger COUNTER = new AtomicInteger(1);
    private static AtomicInteger FAKE_COUNTER = new AtomicInteger(110);

    public static String newOrderNo() {
        long no = (System.currentTimeMillis() / 1000);
        no = (no << 8) + (COUNTER.getAndAdd(1) % 256);
        return String.valueOf(no);
    }


    public static String newFakeOrderNo() {
        long no = (System.currentTimeMillis() / 1000);
        no = (no << 8) + (FAKE_COUNTER.getAndAdd(1) % 256);
        return String.valueOf(no);
    }
}
